package com.example.demo.service;

import com.example.demo.domain.Volunteer;
import com.example.demo.mapper.VolunteerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VolunteerServiceImpl implements VolunteerService{
    @Autowired
    private VolunteerMapper volunteerMapper;
    @Override
    public int addVolunteer(Volunteer volunteer) {
        return volunteerMapper.InsertVolunteer(volunteer);
    }

    @Override
    public int deleteVolunteer(Integer id) {
        return volunteerMapper.DeleteVolunteer(id);
    }

    @Override
    public Volunteer selectVolunteer(Integer volunteer_id) {
        return volunteerMapper.SelectVolunteer(volunteer_id);
    }

    @Override
    public int updateVolunteer(Volunteer volunteer) {
        return volunteerMapper.UpdateVolunteer(volunteer);
    }

    @Override
    public List<Volunteer> findAll() {
        return volunteerMapper.SelectAll();
    }

    @Override
    public int selectAge(Integer min, Integer max) {
        return volunteerMapper.SelectAge(min,max);
    }
}
